package com.ruoyi.prod.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.prod.entity.po.BaseAssetType;
import com.ruoyi.prod.mapper.BaseAssetTypeMapper;
import com.ruoyi.prod.service.BaseAssetTypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 采购管理-资产类别 服务实现类
 * </p>
 *
 * @author 强子初
 * @since 2023-02-16
 */
@Service
public class BaseAssetTypeServiceImpl extends ServiceImpl<BaseAssetTypeMapper, BaseAssetType> implements BaseAssetTypeService {

    @Override
    public List<BaseAssetType> list(BaseAssetType condition) {
        return this.list(this.getWapper(condition));
    }

    private LambdaQueryWrapper<BaseAssetType> getWapper(BaseAssetType condition) {
        LambdaQueryWrapper<BaseAssetType> wrapper = new LambdaQueryWrapper<>();
        if (condition.getName() != null)
            wrapper.like(BaseAssetType::getName, condition.getName());

        if (condition.getStatus() != null)
            wrapper.like(BaseAssetType::getStatus, condition.getStatus());
        return wrapper;
    }
}